Use absolute error instead of average error for path check
authorDaniel Sabo <DanielSabo@gmail.com>
Sun, 12 Jan 2014 02:44:32 +0000 (18:44 -0800)
committerDaniel Sabo <DanielSabo@gmail.com>
Fri, 31 Jan 2014 07:17:29 +0000 (23:17 -0800)
babl/babl-fish-path.c
babl/babl-util.c
babl/babl-util.h

index ebf2cb5b7e69f3f8cfb3ea489cefe6088f00d06b..82838e96ab27b59b33f2f080b132e778ca12c69e 100644 (file)
@@ -708,9 +708,9 @@ get_path_instrumentation (FishPathInstrumentation *fpi,
   babl_process (fpi->fish_destination_to_rgba,
                 fpi->destination, fpi->destination_rgba_double, NUM_TEST_PIXELS);
 
-  *path_error = babl_rel_avg_error (fpi->destination_rgba_double,
-                                    fpi->ref_destination_rgba_double,
-                                    NUM_TEST_PIXELS * 4);
+  *path_error = babl_abs_error (fpi->destination_rgba_double,
+                                fpi->ref_destination_rgba_double,
+                                NUM_TEST_PIXELS * 4);
 
 #if 0
   fpi->fish_rgba_to_source->fish.processings--;
index 92977ac8ca7bda662ee704b8754451a3c12ca6ac..f99b54bd95546397c59d7e9bbf3425d234506dbf 100644 (file)
@@ -88,9 +88,28 @@ babl_process_cost (long ticks_start,
 }
 
 double
-babl_rel_avg_error (double *imgA,
-                    double *imgB,
-                    long    samples)
+babl_abs_error (const double *imgA,
+                const double *imgB,
+                long          samples)
+{
+  double abs_error = 0.0;
+  long   i;
+
+  for (i = 0; i < samples; i++)
+    {
+      double sample_error = fabs (imgA[i] - imgB[i]);
+
+      if (sample_error > abs_error)
+        abs_error = sample_error;
+    }
+
+  return abs_error;
+}
+
+double
+babl_rel_avg_error (const double *imgA,
+                    const double *imgB,
+                    long          samples)
 {
   double error = 0.0;
   long   i;
index bdaeec81351eb5cc46549c811348f79078309c08..8c49619ea41748d6961292e9472dc5f4466a719f 100644 (file)
@@ -27,7 +27,12 @@ babl_process_cost (long ticks_start,
                    long ticks_end);
 
 double
-babl_rel_avg_error (double *imgA,
-                    double *imgB,
-                    long    samples);
+babl_rel_avg_error (const double *imgA,
+                    const double *imgB,
+                    long          samples);
+
+double
+babl_abs_error     (const double *imgA,
+                    const double *imgB,
+                    long          samples);
 #endif